<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username')->comment('用户名');
            $table->string('email')->unique()->comment('邮箱');
            $table->string('password')->comment('密码');
            $table->string('avatar', 200)->comment('头像');
            $table->tinyInteger('is_admin')->default(0)->comment('是否是管理员 0:不是  1:是');
            $table->tinyInteger('is_enable')->default(0)->comment('是否启用 0:不启用  1:启用');
            $table->rememberToken();
            $table->timestamps();
        });
        DB::statement("ALTER TABLE ". env("DB_PREFIX") ."users comment '用户表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
